home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / lang / amigatalk.lha / system / Timer.st < prev    next >
Text File  |  2002-01-18  |  2KB  |  59 lines

  1. "----------------------------------------------------------------------"
  2. " TimerDevice Class is derived from abstract Device Class.             "
  3. ""
  4. "  WARNING:  You should know what you're doing to the Amiga OS before  "
  5. "            messing with this Class, or any other System Class!       "
  6. " ---------------------------------------------------------------------"
  7.  
  8. Class TimerDevice :Device ! private timerType !
  9. [
  10.    stop
  11.       <primitive 228 2 private> "Kill Timer (you still have to close it)."
  12. |
  13.    startWithSecs: s withMicros: m
  14.       <primitive 228 3 private s m>
  15. |
  16.    delaySeconds: s micros: m
  17.       <primitive 228 4 private s m>
  18. |
  19.    test
  20.       ^ <primitive 228 5 private>
  21. |
  22.    getTimerType
  23.       ^ timerType
  24. |
  25.    getSeconds
  26.       ^ <primitive 228 6 private>
  27. |
  28.    getMicros
  29.       ^ <primitive 228 7 private> 
  30. |
  31.    setSeconds: s micros: m
  32.       ^ <primitive 228 8 private s m>
  33. |
  34.    compare: s micros: m toSeconds: s2 micros: m2
  35.  
  36.       " if      t1 >  t2, return -1
  37.       * else if t1 <  t2, return +1
  38.       * else if t1 == t2, return 0
  39.       "
  40.  
  41.       ^ <primitive 228 9 s m s2 m2>
  42. |
  43.    getEClockHigh
  44.       ^ <primitive 228 10 private>
  45. |
  46.    getEClockLow
  47.       ^ <primitive 228 11 private>
  48. |
  49.    openTimer: timerName type: newTimerType seconds: secs  micros: micros
  50.       private   <- <primitive 228 1 newTimerType secs micros timerName>. "Setup Timer"
  51.       timerType <- newTimerType.
  52.  
  53.       ^ self
  54. |
  55.    close
  56.       <primitive 228 0 private>. "Close the Timer"
  57.       private <- nil             "Once closed, it's dead!"
  58.